import 'package:flutter/material.dart';
import 'package:flutter_shequ/api/home.dart';
import 'package:flutter_shequ/constants/index.dart';
import 'package:flutter_shequ/utils/RequestDio.dart';

class HomeNav extends StatelessWidget {
  HomeNav({super.key});
  List navList = [
    {
      'title': '我的房屋',
      'icon': 'assets/images/house_nav_icon@2x.png',
    },
    {
      'title': '我的报修',
      'icon': 'assets/images/repair_nav_icon@2x.png',
    },
    {
      'title': '访客登记',
      'icon': 'assets/images/visitor_nav_icon@2x.png',
    },
  ];
  List<Widget> getchilder() {
    return navList.map((item) {
      return Expanded(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.asset(
              item['icon'],
              width: 35,
            ),
            Text(
              item['title'],
            )
          ],
        ),
      );
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
        width: double.infinity,
        height: 100,
        margin: EdgeInsets.only(top: 10, bottom: 10),
        padding: EdgeInsets.only(bottom: 10, top: 10),
        decoration: BoxDecoration(
            color: Colors.orange, borderRadius: BorderRadius.circular(10)),
        child: Row(
          mainAxisSize: MainAxisSize.max,
          // mainAxisAlignment: MainAxisAlignment.spaceBetween,
          // crossAxisAlignment: CrossAxisAlignment.center,
          children: getchilder(),
        ));
  }
}
